import Vue from 'vue'
import App from './App.vue'
import VueAwesomeSwiper from 'vue-awesome-swiper' //引入轮播图
import 'swiper/css/swiper.css' //引入轮播图样式
import router from './router'; //引入router
import axios from 'axios' //引入sxios
import VueAxios from 'vue-axios' //引入vue-axios
import store from './store' //引入状态管理器
import Rem from './js/rem.js' //引入rem
import VDistpicker from 'v-distpicker'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import vueHashCalendar from 'vue-hash-calendar'
// 引入组件CSS样式
import 'vue-hash-calendar/lib/vue-hash-calendar.css'
// 注册组件库
Vue.use(vueHashCalendar)
Vue.use(ElementUI);
Vue.prototype.$Rem = Rem;
Vue.use(VueAwesomeSwiper)
Vue.use(VueAxios, axios)
Vue.component('v-distpicker', VDistpicker)
Vue.config.productionTip = false

/* axios全局拦截器 */
axios.interceptors.request.use((config) => {
	//原始的发送给接口的数据
	//二次加工config
	//return 出去就发送给服务器
	// console.log(config)
	config.headers.token = localStorage.getItem("token");
	return config; //发送加工后的数据 给服务器
}, (error) => {
	return Promise.reject(error);
	//抛出给 catch
});

axios.interceptors.response.use(function(res) {
	// console.log(res)
	switch (res.data.node) {
		case 4000:
			
			return;
	}
	return res.data;
}, function(error) {
	return Promise.reject(error);
});

new Vue({
  render: h => h(App),
	router,
	store
}).$mount('#app')
